import { request } from './index'

// 获得商品数据
export function GetGoodsFnc (data: {query: string, pagenum: number, pagesize: number}) {
  return request({
    url: `/goods?query=${data.query}&pagenum=${data.pagenum}&pagesize=${data.pagesize}`
  })
}

// 显示编辑商品盒子
export function ShowEditProductFnc (id: number) { 
  return request({
    url: `/goods/${id}`,
    method: 'get'
  })
}

// 编辑商品  
export function EditProductFnc (id: number, data: {goods_name: string, goods_price: number, goods_number: number, goods_weight: number}) { 
   return request({
    url: `/goods/${id}`,
    method: 'put',
    data: data
  })
}

// 删除商品
export function DeleteProductsFnc (id: number) {
  return request({
    url: `/goods/${id}`,
    method: 'delete'
  })
}

// 添加商品按钮里面 获得商品分类
export function GetProductCategoryFnc () {
  return request({
    url: '/categories',
    method: 'get'
  })
}